package org.easy.async;

/**
 * @Description:
 * @Author: wxl
 * @CreateTime: 2023/1/31 17:16
 */
public  class EasyThread<T> implements Runnable{

    protected T object;

    protected BusinessHandler<T> handler;

    public EasyThread () {}

    public EasyThread (T object) {
        this();
        this.object = object;
    }

    public EasyThread (T object,BusinessHandler<T> handler) {
        this(object);
        this.handler = handler;
    }

    @Override
    public void run() {
        this.handler.handler(object);
    }

    /**
     * 设置
     * @param object 对象
     */
    public  void setObject(T object) {
        this.object = object;
    }

    /**
     * 获取对象
     * @return T
     */
    public T getObject() {
        return object;
    }

}
